//
//  HistoryView.m
//  Bracelet
//
//  Created by jing zhao on 2/12/15.
//  Copyright (c) 2015 jing zhao. All rights reserved.
//

#import "Mycity_HistoryView.h"
#import "APIMycityHistory.h"

@interface Mycity_HistoryView ()<UIWebViewDelegate>

@property(strong, nonatomic)APIMycityHistory *apiHistory;
@property (weak, nonatomic) IBOutlet UIActivityIndicatorView *ui_activityView;
@property (weak, nonatomic) IBOutlet UIWebView *ui_webView;

@end

@implementation Mycity_HistoryView

-(void)initWithType:(NSString*)type
{
    if ([type isEqualToString:@"HBCN"])
        return;

    [self.ui_activityView startAnimating];
//    [self updateNetwork];
//    self.ui_webView.delegate = self;

    
}

-(void)updateNetwork
{
    UIRefreshTableView *refresh = (UIRefreshTableView*)self.superview;
    [APIMycityHistory getMycityHistrorySuccess:^(APIMycityHistory *mycityHistory) {
        [self.ui_webView loadHTMLString:mycityHistory.strHtml baseURL:nil];
        [self.ui_activityView stopAnimating];
        [refresh endRefreshData];
    } failure:^(NSError *error) {
        [self.ui_activityView stopAnimating];
        [refresh endRefreshData];
    }];
}

//- (void)webViewDidFinishLoad:(UIWebView *)webView
//{
//    self.ui_webView.scrollView.contentSize = CGSizeMake(webView.frame.size.width, webView.scrollView.contentSize.height);
//}

@end
